{strip}
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
{config_load file="main.conf"}
<head>
    <title>{#title#}</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <link rel="stylesheet" type="text/css" href="{$design}style/main.css" />
    <link rel="stylesheet" type="text/css" href="{$design}style/head.css" />
    <link rel="stylesheet" type="text/css" href="{$design}style/left.css" />
    <link rel="stylesheet" type="text/css" href="{$design}style/footer.css" />
    <link rel="stylesheet" type="text/css" href="{$design}style/content.css" />
</head>
<body>
    <div id="imageupload" style="display: none"></div>
    <div align="center">
        <div class="Main">
            {include file="global/head.tpl"}
            {include file="global/left.tpl"}
            <div class="Content" align="left">
                <div class="Caption">Действие</div>
                <div class="RealContent">
                    <a href="{$curSiteDir}/{$curPage}">Показать фотографии</a>
                    <a href="{$curSiteDir}/{$curPage}?action=add">Добавить фотографию</a>
                </div>
                {if !isset($smarty.get.action)}
                    <div class="Caption">Фотографии</div>
                    <div class="RealContent">
                        <div class="pages">
                            {foreach item=item from=$currentPhotos}
                                <div class="page">
                                    {$item.maintext}
                                    <a href="{$curSiteDir}/{$curPage}?photoid={$item.photoid}&action=delete">Удалить</a>
                                    <a href="{$curSiteDir}/{$curPage}?photoid={$item.photoid}&action=change">Изменить</a>
                                </div>
                            {/foreach}
                        </div>
                    </div>
                {/if}

                {if $smarty.get.action == "add"}
                    <div class="Caption">Добавление фотографии</div>
                    <div class="RealContent">
                        <form class="block" method="post" action="{$curSiteDir}/{$curPage}" enctype="multipart/form-data">

                            <div class="inputBlock">
                                <p>
                                    Описание фотографии
                                </p>
                                <textarea class="maintext" name="maintext">
                                </textarea>
                            </div>
                            <br clear="left" />

                            <div class="inputBlock">
                                <p>
                                    Фотография
                                </p>
                                <input name="image" type="file" />
                            </div>
                            <br clear="left" />
                            
                            <br />
                            <input type="submit" value="Добавить" name="photoAddEnter" />
                            <input type="reset" value="Очистить" />
                            <input type="submit" value="Отмена" name="cancel" />
                        </form>
                    </div>
                {/if}
                
                {if $smarty.get.action == "change"}
                    <div class="Caption">Изменение фотографии</div>
                    <div class="RealContent">
                        <form class="block" method="post" action="{$curSiteDir}/{$curPage}" enctype="multipart/form-data">

                            <div class="inputBlock">
                                <p>
                                    Описание фотографии
                                </p>
                                <textarea class="maintext" name="maintext">
                                    {$currentPhoto.maintext}
                                </textarea>
                            </div>
                            <br clear="left" />

                            <div class="inputBlock">
                                <p>
                                    Фотография
                                </p>
                                {if $currentPhoto.path != ""}
                                    <img style="display: block; margin: 10px 0 10px 0;" alt="" src="{$currentPhoto.path}" />
                                {/if}
                                <input name="image" type="file" />
                            </div>
                            <br clear="left" />

                            <input type="text" style="display: none;" value="{$currentPhoto.photoid}" name="photoid" />

                            <br />
                            <input type="submit" value="Изменить" name="photoChangeEnter" />
                            <input type="reset" value="Очистить" />
                            <input type="submit" value="Отмена" name="cancel" />
                        </form>
                    </div>
                {/if}
                
                {if $smarty.get.action == "delete"}
                    <div class="Caption">Удаление фотографии {$currentPhoto.maintext}</div>
                    <div class="RealContent">
                        <form class="block" method="post" action="{$curSiteDir}/{$curPage}">
                            <input type="text" style="display: none;" value="{$currentPhoto.photoid}" name="photoid" />
                            <p>Действительно ли Вы хотите удалить фотографию {$currentPhoto.maintext}?</p>
                            <br />
                            <input type="submit" value="Отмена" name="cancel" />
                            <input type="submit" value="Удалить" name="photoDeleteEnter" />
                        </form>
                    </div>
                {/if}
                
            </div>
            <br clear="left" />
            {include file="global/footer.tpl"}
        </div>
    </div>
</body>
</html>
{/strip}